import { getBlogArticles, getCategories } from "@/lib/api";
import BlogCard from "@/components/BlogCard";

export default async function Home() {
  const [articles, categories] = await Promise.all([
    getBlogArticles(100, 1),
    getCategories(100, 1),
  ]);
  console.log("🚀 ~ Home ~ articles:", articles);
  return (
    <div className="container mx-auto p-4">
      <h1 className="text-3xl font-bold mb-6">博客首页</h1>
      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        {articles.map((article: any) => (
          <BlogCard
            key={article.id}
            article={article}
            categories={categories}
          />
        ))}
      </div>
    </div>
  );
}
